import Vue from 'vue'
import Router from 'vue-router'
import VideoHomePage from "../pages/VideoHomePage";
import PptPage from "../pages/PptPage";
import HomePage from "@/pages/HomePage";
import SupportHomePage from "@/pages/SupportHomePage";
import SentenceMaintain from "@/components/SentenceMaintain";
import ModifySentenceKnowledge from "@/components/ModifySentenceKnowledge";

Vue.use(Router);
const routerPush = Router.prototype.push;
Router.prototype.push = function push(location) {
    return routerPush.call(this, location).catch(error=> console.log("error",error))
}

export default new Router({
    mode: 'history',
    routes: [
        {
            path: '/ppt',
            name: 'home',
            component: HomePage
        },
        {
            path: '/videoHomePage/:chapterNumStr/:videoNumStr/:isStart',
            name: 'videoHomePage',
            component: VideoHomePage,
            props: true
        },
        {
            path: '/pptPage/:chapterNumStr/:videoNumStr/:pageNumStr',
            component: PptPage,
            props: true
        },
        {
            path: '/supp',
            component: SupportHomePage,
            redirect: '/supp/sentenceMaintain',
            children: [
                {
                    path: 'sentenceMaintain',
                    component: SentenceMaintain
                },
                {
                    path: 'modifySentenceKnowledge/:videoNum/:sentenceNum',
                    component: ModifySentenceKnowledge,
                    props: true
                }
            ]
        }
    ]
})